﻿using System;

namespace SimpleFactory
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                // 1. 通过工厂创建Kmeans算法实例
                IClustering kmeans = ClusteringFactory.CreateClustering("Kmeans");
                Console.WriteLine("=== Kmeans算法执行结果 ===");
                Console.WriteLine(kmeans.Calculate());
                Console.WriteLine();

                // 2. 通过工厂创建Dbscan算法实例
                IClustering dbscan = ClusteringFactory.CreateClustering("Dbscan");
                Console.WriteLine("=== Dbscan算法执行结果 ===");
                Console.WriteLine(dbscan.Calculate());
                Console.WriteLine();

                // 3. 通过工厂创建层次聚类实例
                IClustering hierarchical = ClusteringFactory.CreateClustering("Hierarchical");
                Console.WriteLine("=== 层次聚类算法执行结果 ===");
                Console.WriteLine(hierarchical.Calculate());
            }
            catch (Exception ex)
            {
                Console.WriteLine($"程序出错：{ex.Message}");
            }

            // 防止控制台闪退
            Console.ReadLine();
        }
    }
}
